package top.hongsheng9527.bookdownload.service;


import top.hongsheng9527.bookdownload.core.crawl.RuleBean;
import top.hongsheng9527.bookdownload.vo.CrawlSingleTask;
import top.hongsheng9527.bookdownload.vo.CrawlSource;
import top.hongsheng9527.bookdownload.vo.PageBean;


/**
 * @author Wanghs
 * @create 2022/4/8
 * @description
 */
public interface CrawlService {

    /**
     * 新增爬虫源
     *
     * @param source 爬虫源提交的数据对象
     */
    void addCrawlSource(CrawlSource source);


    /**
     * 爬虫源分页列表
     *
     * @return 爬虫源分页数据
     */
    CrawlSource listCrawlByPage(String address);

    /**
     * 采集并保存小说
     *
     * @param ruleBean 采集规则\
     * @return true:成功，false:失败
     */
//    boolean parseBookAndSave(int catId, RuleBean ruleBean, Integer sourceId, String bookId, String SAVE_PATH);
    boolean parseBookAndSave(CrawlSingleTask task, RuleBean ruleBean, String SAVE_PATH);

    /**
     * 查询爬虫源
     *
     * @param sourceId 源ID
     * @return 源信息
     */
    CrawlSource queryCrawlSource(Integer sourceId);

    /**
     * 新增单本采集任务
     *
     * @param singleTask 任务信息对象
     */
    void addCrawlSingleTask(CrawlSingleTask singleTask);


}
